package com.carlinfo.userscenter.stu.pojo;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;
import java.util.TreeMap;

import com.carlinfo.common.util.DateUtil;

/**
 * 等级表的pojo
 * 
 * @author 90711
 * @param name       对应的学生姓名
 * @param startMarks 初始分数
 * @param finalMarks 结束分数
 * @param createTime 创建时间
 * @param updateTime 结束时间
 * 
 */
public class Level implements Serializable
{
	private int id;
	private String name;
	private double startMarks;
	private double finalMarks;
	private Date createTime;
	private Date updateTime;
	private Date pubTime;
	private String context;
	private byte status;
	
	/* 定义状态的字符串 */
	private String statusStr;
	private Map<String, ADynastyEnum> statusMap;

	public int getId()
	{
		return id;
	}

	public void setId(int id)
	{
		this.id = id;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public double getStartMarks()
	{
		return startMarks;
	}

	public void setStartMarks(double startMarks)
	{
		this.startMarks = startMarks;
	}

	public double getFinalMarks()
	{
		return finalMarks;
	}

	public void setFinalMarks(double finalMarks)
	{
		this.finalMarks = finalMarks;
	}

	public Date getCreateTime()
	{
		return createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	public Date getUpdateTime()
	{
		return updateTime;
	}

	public void setUpdateTime(Date updateTime)
	{
		this.updateTime = updateTime;
	}

	@Override
	public String toString()
	{
		DateUtil dateUtil = new DateUtil();
		return getId() + "\t" + getName() + "\t\t" + getStartMarks() + "\t\t" + getFinalMarks() + "\t\t"
				+ dateUtil.dateTimeToStr(getCreateTime()) + "\t" + dateUtil.dateTimeToStr(getUpdateTime());
	}

	public Date getPubTime()
	{
		return pubTime;
	}

	public void setPubTime(Date pubTime)
	{
		this.pubTime = pubTime;
	}

	public String getContext()
	{
		return context;
	}

	public void setContext(String context)
	{
		this.context = context;
	}

	public byte getStatus()
	{
		return status;
	}

	public void setStatus(byte status)
	{
		this.status = status;
	}

	public String getStatusStr()
	{
		ADynastyEnum[] values = ADynastyEnum.values();
		for (ADynastyEnum enumTemp : values)
		{
			if(this.status==enumTemp.getValue() && enumTemp.toString().startsWith("STATUS_"))
			{
				this.statusStr = enumTemp.getInfo();
			}
		}
		return statusStr;
	}
	
	public Map<String, ADynastyEnum> getStatusMap()
	{
		this.statusMap= new TreeMap<String, ADynastyEnum>();
		ADynastyEnum[] values = ADynastyEnum.values();
		for (ADynastyEnum enumTemp : values)
		{
			if(enumTemp.toString().startsWith("STATUS_"))
			{
				this.statusMap.put(enumTemp.getValue()+"", enumTemp);
			}
		}
		return statusMap;
	}
}
